From 0ef6492518593eb1255e83723aaf9195fb582d6f Mon Sep 17 00:00:00 2001 From: andi34 Date: Sat, 9 May 2015 10:48:52 -0700 Subject: updater: Allow devices to suppress BLKDISCARD * On some devices TRIM is disabled for security reasons. Don't fail flashing the ROM because discard isn't possible in this case. Change-Id: I044619c3e0b01a496d967ef136501d0190240ad4 --- updater/Android.mk | 4 ++++ updater/blockimg.cpp | 2 ++ 2 files changed, 6 insertions(+) diff --git a/updater/Android.mk b/updater/Android.mk index 3d2591391..b6955455a 100644 --- a/updater/Android.mk +++ b/updater/Android.mk @@ -74,6 +74,10 @@ LOCAL_CFLAGS := \ -Wall \ -Werror +ifeq ($(BOARD_SUPPRESS_EMMC_WIPE),true) + LOCAL_CFLAGS += -DSUPPRESS_EMMC_WIPE +endif + LOCAL_EXPORT_C_INCLUDE_DIRS := \ $(LOCAL_PATH)/include diff --git a/updater/blockimg.cpp b/updater/blockimg.cpp index e93196b27..b44e1a219 100644 --- a/updater/blockimg.cpp +++ b/updater/blockimg.cpp @@ -1499,10 +1499,12 @@ static int PerformCommandErase(CommandParameters& params) { // length in bytes blocks[1] = (range.second - range.first) * static_cast(BLOCKSIZE); +#ifndef SUPPRESS_EMMC_WIPE if (ioctl(params.fd, BLKDISCARD, &blocks) == -1) { PLOG(ERROR) << "BLKDISCARD ioctl failed"; return -1; } +#endif } } -- cgit v1.2.3